*******************************************************************************************
*******************************************************************************************
******************** Reclassification Risk in the Small Group Health Insurance Market
******************* by Sebastian Fleitas, Gautam Gowrisankaran and Anthony Lo Sasso 
*******************************************************************************************
*******************************************************************************************
*******************************************************************************************
******************** Table A1
*******************************************************************************************
*******************************************************************************************
*******************************************************************************************

 
cd "/Users/sebastianfleitas/Dropbox/ReclassificationRisk"
use database_individual_level.dta, replace 


********************************************************************************************* 
*** TABLE 5 (Individual Level Regressions with Claims and ACG Scores)
*********************************************************************************************
reg paid_sum laggedscore marketdum* if year==2014 &  firmstays==1, vce(cluster customer_number)
eststo mod2 
reg allowed_sum laggedscore marketdum* if year==2014 & firmstays==1 , vce(cluster customer_number)
eststo mod3
reg outpocket laggedscore marketdum* if year==2014 &  firmstays==1 , vce(cluster customer_number)
eststo mod4 
****************************************************************************************************************** fragment
*********TABLE 
esttab mod2 mod3 mod4 using Restat_Table5_year2014_Passthrough_claims_risk.tex , replace label  se(%5.0fc) nonotes nonumbers stats(N, fmt(%12.0fc)) compress b(%12.0fc) nogaps  ///
		title(Estimates Scores to Claims Pass-through Regressions) mtitles("I" "II" "III") ///
		star(* 0.10 ** 0.05 *** 0.01)  ///
		keep( laggedscore ) ///
		prefoot( \hline "Dep. Var. & Paid & Allowed & OPP" \\ /// 
		"Market FE & Yes & Yes & Yes" \\ ///
		"Sample & 2013 & 2013 & 2013 "\\ \hline) 
eststo clear
*********************************************************************************************
*********************************************************************************************

reg paid_sum laggedscore_ORS marketdum* if year==2014 &  firmstays==1, vce(cluster customer_number)

*exit 

**********************************************************************************************
/*
**********************************************************************************************
****** HERE STUFF FOR COMPARISON WITH USIC OTHER DATA 
drop if year!=2014
keep indv_id laggedscore
sort indv_id
saveold torobustnessACGscore.dta, replace
**********************************************************************************************
*/
**********************************************************************************************


set more off 
********************************************************************************************* 
*** TABLE 5 Robustness (Individual Level Regressions with Claims and ACG Scores for 2013)
*********************************************************************************************
reg paid_sum laggedscore marketdum* if year==2013 &  firmstays==1, vce(cluster customer_number)
eststo mod2 
reg allowed_sum laggedscore marketdum* if year==2013 & firmstays==1 , vce(cluster customer_number)
eststo mod3
reg outpocket laggedscore marketdum* if year==2013 &  firmstays==1 , vce(cluster customer_number)
eststo mod4 
****************************************************************************************************************** fragment
*********TABLE 
esttab mod2 mod3 mod4 using Table9A_year2013_Passthrough_claims_risk.tex , replace label  se(%5.0fc) nonotes nonumbers stats(N, fmt(%12.0fc)) compress b(%12.0fc) nogaps  ///
		title(Estimates Scores to Claims Pass-through Regressions) mtitles("I" "II" "III") ///
		star(* 0.10 ** 0.05 *** 0.01)  ///
		keep( laggedscore ) ///
		prefoot( \hline "Dep. Var. & Paid & Allowed & OPP" \\ /// 
		"Market FE & Yes & Yes & Yes" \\ ///
		"Sample & 2014 & 2014 & 2014 "\\ \hline) 
eststo clear
*********************************************************************************************
*********************************************************************************************

}

********************************************************************************************* 
*** TABLE 5 Robustness (Individual Level Regressions with Claims and ACG Scores for 2013)
*********************************************************************************************

***** Regressions for splines 
set more off
*********************************************************************************************
*********************************************************************************************
xtset mbr_sys_id year
mkspline  acgS1 1 acgS2 2.5 acgS3 5 acgS4 = laggedscore
mkspline  AacgSS1 .32 AacgSS2 .57 AacgSS3 1.13 AacgSS4 = laggedscore
****************************************************************************************************************** fragment
reg paid_sum acgS*   if year==2014 &  firmstays==1, vce(cluster customer_number)
eststo mod1 
reg paid_sum acgS* marketdum*  if year==2014 &  firmstays==1, vce(cluster customer_number)
eststo mod2
reg paid_sum AacgSS* if year==2014 &  firmstays==1, vce(cluster customer_number)
eststo mod3
reg paid_sum AacgSS* marketdum* if year==2014 &  firmstays==1, vce(cluster customer_number)
eststo mod4

